<!DOCTYPE html>
<html ng-app="myapp">

<head>
    <meta charset="utf-8">
    <script src="public/lib/angular/angular.min.js"></script>
</head>

<body>
    <div ng-controller="c2_1">
        执行JavaScript表达式：
        <br>
        <input type="text" name="" ng-model="expr1">
        <button ng-click="testExp1(expr1)">计算</button>
        <br>
        <br> 执行Angular表达式：
        <br>
        <input type="text" name="" ng-model="expr2">
        <span ng-bind="$eval(expr2)"></span>
    </div>
    <script type="text/javascript">
    var myapp = angular.module('myapp', []);
    myapp.controller('c2_1', ['$scope', function($scope) {
        $scope.expr1 = 20;
        $scope.expr2 = '20+1|number:0';
        $scope.testExp1 = function(expr) {
            /* body... */
            var newv = parseInt(expr) + 1;
            console.log(newv);

        }
    }]);
    </script>
</body>

</html>
